include( 'shared.lua' )
include( 'cl_spawnmenu.lua' )
include( 'cl_notice.lua' )

local PlayerMeta = FindMetaTable("Player")

function GM:OnSpawnMenuOpen()
	GAMEMODE:ShowSpawnMenu()
end

function GM:OnSpawnMenuClose()
	GAMEMODE:CloseSpawnMenu()
end

function GM:OnUndo( name, strCustomString )
	if ( !strCustomString ) then
		self:AddNotify( "Undone "..name, NOTIFY_UNDO, 2 )
	else	
		self:AddNotify( strCustomString, NOTIFY_UNDO, 2 )
	end
	
	// Find a better sound :X
	surface.PlaySound( "buttons/button15.wav" )

end

function GM:HUDPaint()
	// Draw all of the default stuff
	self.BaseClass:HUDPaint()
	self:PaintNotes()
end

function ProcessWork(workType)
	GAMEMODE:AddNotify("finished work: "..workType, NOTIFY_GENERIC, 2)
end

function StartWork( userMessage )
	local workType = userMessage:ReadString()
	local length = userMessage:ReadShort()
	timer.Adjust("doWork", length, 0, ProcessWork, workType)
	timer.Start("doWork")
end

function StopWork( userMessage )
	timer.Stop("doWork")
	GAMEMODE:AddNotify("Stopped working", NOTIFY_GENERIC, 2)
end


usermessage.Hook("ks_startWork", StartWork )
usermessage.Hook("ks_stopWork", StopWork )

TraceEyesResult = nil


